<!DOCTYPE html>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
  <title>管理员控制台</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
  <style>
    :root {
      --primary-color: #4CAF50;
      --secondary-color: #f8f9fa;
      --card-shadow: 0 4px 8px rgba(0,0,0,0.05);
      --hover-color: rgba(76, 175, 80, 0.1);
    }

    body {
      background-color: #f5f7fa;
      font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
      margin: 0;
      padding: 0;
    }

    .sidebar {
      background-color: white;
      height: 100vh;
      box-shadow: 2px 0 10px rgba(0,0,0,0.05);
      position: fixed;
      z-index: 100;
      width: 250px;
    }

    .sidebar .nav-link {
      color: #495057;
      border-radius: 5px;
      margin-bottom: 5px;
      padding: 10px 15px;
    }

    .sidebar .nav-link:hover, .sidebar .nav-link.active {
      background-color: var(--hover-color);
      color: var(--primary-color);
    }

    .sidebar .nav-link i {
      margin-right: 10px;
      width: 20px;
      text-align: center;
    }

    .main-content {
      margin-left: 250px;
      padding: 30px;
      min-height: 100vh;
    }

    .page-header {
      background-color: white;
      padding: 20px 25px;
      border-radius: 10px;
      box-shadow: var(--card-shadow);
      margin-bottom: 25px;
    }

    .dashboard-card {
      background-color: white;
      border-radius: 10px;
      box-shadow: var(--card-shadow);
      padding: 25px;
      margin-bottom: 25px;
      transition: transform 0.3s, box-shadow 0.3s;
      height: 100%;
      border: none;
    }

    .dashboard-card:hover {
      transform: translateY(-5px);
      box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    }

    .card-icon {
      font-size: 2.5rem;
      color: var(--primary-color);
      margin-bottom: 20px;
    }

    .card-title {
      font-size: 1.25rem;
      font-weight: 600;
      margin-bottom: 15px;
      color: #343a40;
    }

    .card-action {
      margin-top: 20px;
    }

    .btn-card {
      background-color: var(--primary-color);
      color: white;
      border-radius: 5px;
      padding: 10px 15px;
      font-size: 0.95rem;
      display: inline-block;
      text-align: center;
      text-decoration: none;
      border: none;
      cursor: pointer;
      transition: background-color 0.3s;
    }

    .btn-card:hover {
      background-color: #3d8b40;
      color: white;
    }

    .admin-info {
      padding: 30px 20px 20px;
      text-align: center;
      border-bottom: 1px solid #e9ecef;
    }

    .admin-avatar {
      width: 85px;
      height: 85px;
      border-radius: 50%;
      background-color: #e9f5eb;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 15px;
      color: var(--primary-color);
      font-size: 2.5rem;
    }

    .admin-name {
      font-weight: 600;
      margin-bottom: 5px;
      font-size: 1.2rem;
    }

    .admin-role {
      color: #6c757d;
      font-size: 0.95rem;
      background-color: #e9f5eb;
      padding: 3px 10px;
      border-radius: 15px;
      display: inline-block;
      margin-top: 10px;
    }

    .stat-number {
      font-size: 2rem;
      font-weight: 700;
      color: var(--primary-color);
      margin: 10px 0;
    }

    .notification-badge {
      position: absolute;
      top: 5px;
      right: 10px;
      background-color: #dc3545;
      color: white;
      border-radius: 50%;
      width: 22px;
      height: 22px;
      font-size: 0.8rem;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .activity-item {
      padding: 15px 0;
      border-bottom: 1px solid #eee;
      display: flex;
    }

    .activity-item:last-child {
      border-bottom: none;
    }

    .activity-icon {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background-color: #e9f5eb;
      color: var(--primary-color);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-right: 15px;
      flex-shrink: 0;
    }
  </style>
</head>
<body>
<div class="sidebar">
  <div class="admin-info">
    <div class="admin-avatar">
      <i class="bi bi-person-badge"></i>
    </div>
    <div class="admin-name">${user.username}</div>
    <div class="admin-role">系统管理员</div>
  </div>

  <nav class="nav flex-column mt-4 px-2">
    <a class="nav-link active" href="adminHome.jsp">
      <i class="bi bi-speedometer2"></i> 控制面板
    </a>
    <a class="nav-link" href="admin/members">
      <i class="bi bi-people"></i> 会员管理
    </a>
    <a class="nav-link" href="admin/houses">
      <i class="bi bi-house-door"></i> 房产管理
    </a>
    <a class="nav-link" href="admin/venues">
      <i class="bi bi-building"></i> 场馆管理
    </a>
    <a class="nav-link" href="admin/users">
      <i class="bi bi-person-gear"></i> 用户管理
    </a>
    <a class="nav-link" href="admin/profile">
      <i class="bi bi-person-circle"></i> 个人设置
    </a>
    <a class="nav-link" href="admin/logout" style="margin-top: 20px;">
      <i class="bi bi-box-arrow-right"></i> 退出系统
    </a>
  </nav>
</div>

<div class="main-content">
  <div class="page-header">
    <div class="d-flex justify-content-between align-items-center">
      <div>
        <h2>管理员控制台</h2>
        <p class="text-muted mb-0">欢迎回来，${user.username}！</p>
      </div>
      <div class="d-flex">
        <div class="position-relative me-3">
          <a href="#" class="btn btn-outline-secondary position-relative">
            <i class="bi bi-bell"></i>

          </a>
        </div>
        <div class="dropdown">
          <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-bs-toggle="dropdown">
            <i class="bi bi-gear"></i>
          </button>
          <ul class="dropdown-menu">
            <li><a class="dropdown-item" href="admin/profile">个人设置</a></li>
            <li><a class="dropdown-item" href="#">系统设置</a></li>
            <li><hr class="dropdown-divider"></li>
            <li><a class="dropdown-item" href="admin/logout">退出系统</a></li>
          </ul>
        </div>
      </div>
    </div>
  </div>

  <div class="row">
    <div class="col-md-3 col-sm-6 mb-4">
      <div class="dashboard-card text-center">
        <div class="card-icon">
          <i class="bi bi-people"></i>
        </div>
        <h3 class="card-title">会员管理</h3>
        <div class="stat-number">${allCount.member_count}</div>
        <p>已注册会员总数</p>
        <div class="card-action">
          <a href="admin/members" class="btn-card">管理会员</a>
        </div>
      </div>
    </div>

    <div class="col-md-3 col-sm-6 mb-4">
      <div class="dashboard-card text-center">
        <div class="card-icon">
          <i class="bi bi-house-door"></i>
        </div>
        <h3 class="card-title">房产管理</h3>
        <div class="stat-number">${allCount.house_count}</div>
        <p>社区可售房产</p>
        <div class="card-action">
          <a href="admin/houses" class="btn-card">查看房产</a>
        </div>
      </div>
    </div>

    <div class="col-md-3 col-sm-6 mb-4">
      <div class="dashboard-card text-center">
        <div class="card-icon">
          <i class="bi bi-building"></i>
        </div>
        <h3 class="card-title">场馆设施</h3>
        <div class="stat-number">${allCount.venue_count}</div>
        <p>公共设施数量</p>
        <div class="card-action">
          <a href="admin/venues" class="btn-card">场馆管理</a>
        </div>
      </div>
    </div>

    <div class="col-md-3 col-sm-6 mb-4">
      <div class="dashboard-card text-center">
        <div class="card-icon">
          <i class="bi bi-person-gear"></i>
        </div>
        <h3 class="card-title">用户管理</h3>
        <div class="stat-number">${allCount.user_count}</div>
        <p>系统用户总数</p>
        <div class="card-action">
          <a href="admin/users" class="btn-card">管理用户</a>
        </div>
      </div>
    </div>
  </div>

  <div class="row mt-2">
    <div class="col-lg-8">
      <div class="dashboard-card">
        <h3 class="card-title">系统动态</h3>
        <div class="mt-4">
          <div class="activity-item">
            <div class="activity-icon">
              <i class="bi bi-plus-circle"></i>
            </div>
            <div>
              <h5 class="mb-1">新会员注册</h5>
              <p class="mb-1">张建国先生（68岁）已成功注册成为社区会员</p>
              <small class="text-muted">2025年7月8日 09:23</small>
            </div>
          </div>

          <div class="activity-item">
            <div class="activity-icon">
              <i class="bi bi-house-check"></i>
            </div>
            <div>
              <h5 class="mb-1">房产交易完成</h5>
              <p class="mb-1">会员李爱华已成功购买B区5栋302室</p>
              <small class="text-muted">2025年7月7日 14:15</small>
            </div>
          </div>

          <div class="activity-item">
            <div class="activity-icon">
              <i class="bi bi-calendar-check"></i>
            </div>
            <div>
              <h5 class="mb-1">活动预定</h5>
              <p class="mb-1">王丽娟女士预定了7月10日的健康讲座活动</p>
              <small class="text-muted">2025年7月7日 10:41</small>
            </div>
          </div>

          <div class="activity-item">
            <div class="activity-icon">
              <i class="bi bi-person-plus"></i>
            </div>
            <div>
              <h5 class="mb-1">新员工加入</h5>
              <p class="mb-1">新客服人员陈晓东已加入团队</p>
              <small class="text-muted">2025年7月6日 16:30</small>
            </div>
          </div>
        </div>
        <%--<div class="card-action mt-4">
          <a href="#" class="btn-card">查看全部动态</a>
        </div>--%>
      </div>
    </div>

    <div class="col-lg-4">
      <div class="dashboard-card">
        <h3 class="card-title">快速操作</h3>
        <div class="mt-4">
          <a href="admin/members?action=add" class="d-block mb-3 btn-card text-center">
            <i class="bi bi-person-plus me-2"></i>添加新会员
          </a>

          <a href="admin/houses?action=new" class="d-block mb-3 btn-card text-center">
            <i class="bi bi-house-add me-2"></i>录入新房产
          </a>

          <a href="admin/venues?action=schedule" class="d-block mb-3 btn-card text-center">
            <i class="bi bi-calendar-plus me-2"></i>安排新活动
          </a>

          <a href="admin/users?action=add" class="d-block mb-3 btn-card text-center">
            <i class="bi bi-person-badge me-2"></i>添加新用户
          </a>
        </div>
      </div>
    </div>
  </div>
</div>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>